package libx

import (
	"runtime"
)

type System int

const (
	Windows System = iota
	Linux
	MacOS
	Unknown
)

func GetOS() System {
	os := runtime.GOOS
	switch os {
	case "windows":
		return Windows
	case "linux":
		return Linux
	case "darwin":
		return MacOS
	default:
		return Unknown
	}
}

func SelOsVal[T any](windowsValue T, linuxValue T, macOSValue T, unknownValue T) T {
	switch GetOS() {
	case Windows:
		return windowsValue
	case Linux:
		return linuxValue
	case MacOS:
		return macOSValue
	default:
		return unknownValue
	}
}
